<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    // 1- 字面量(单例模式)
    let obj = {
        userName:"zhangsan",
        age:12
    }
    let obj2 = {
        userName:"lisi",
        age:15
    }

    // 2- 工厂函数
    function fn(userName,age){
        return {
            userName,
            age
        }
    }
    const obj3 = fn("wangwu",18);

    // 3- new Object
    const obj4 = new Object({
        userName:"zhaoliu",
        age:90
    })

    // 4- 构造函数
    function Box(userName,age){
        this.userName = userName;
        this.age = age;
    }
    const obj5 = new Box("yanqi",89);
</script>
</html>